package Month07.day05;

public class array1 {
    public static void main(String[] args) {
        int[] a = {12, 45, 6, 5, 65};
        int[] b = array(a);
        System.out.println("最小值是:" + b[0]);
        System.out.println("最大值是:" + b[1]);
    }

    public static int[] array(int[] arr) {
        int max = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (max < arr[i]) {
                max = arr[i];
            }
        }
        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if (min > arr[i]) {
                min = arr[i];
            }
        }
        int[] minandmax = {min, max};
        //return max;
        return minandmax;
    }
}
